-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
subclass IPython.core.display HTML object for more flexibility. #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
By defining `_repr_*_` functions, IPython will just call these functions when a non-HTML representation is required.
👍 for doing this. I have mixed feelings about making IPython a dependency for plotly. Yes plotly is at its best inside IPython notebooks (so it might a good idea to force users to use IPython). |
ok, yeah, i think i'm leaning that way too. just wanted another opinion on it. we can probably do something like this:
That way it's private (well... not there at all really) if folks don't have ipython, it's not defined dynamically, which is not really an appropriate solution here, and we can put it whereverz. it's sort of like this: https://github.com/plotly/python-api/blob/master/plotly/tools.py#L27-31 Seem alright? |
@theengineear good call. If you have 💃 |
luv it - def shouldn't be a requirement! On Mon, Aug 18, 2014 at 4:18 PM, Étienne Tétreault-Pinard <
|
|
||
def svg_worker(display_obj, results): | ||
img = display_obj._repr_svg_() | ||
if img[:4] == '<svg': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anyone know a way to check if a file is valid svg? (i'm guessing this is not a good way to do it...) (imghdr lib doesn't help...)
k, pretty sure everyone is onboard. merging. |
subclass IPython.core.display HTML object for more flexibility.
By defining
_repr_*_
functions, IPython will just call thesefunctions when a non-HTML representation is required.